package day06;

import java.io.*;
import java.util.Scanner;

/**
 * 创建一个文件"note.txt",然后通过控制台输入的每一行字符串都按行写入到
 * note.txt中。当输入的字符串为"exit"时退出程序。
 * @author Bonnie
 *
 */
public class Test09 {
    public static void main(String[] args) throws IOException {
        File fname = new File("./Home_Work/src/day06/note.txt");
        fname.createNewFile();
        FileWriter fos = new FileWriter(fname);
        Scanner reader = new Scanner(System.in);
        String line;
        while ((line = reader.nextLine()) != null) {
            if (line.equals("exit")) {
                break;
            }
            fos.write(line);
            fos.write("\r\n");
        }
        reader.close();
        fos.close();

    }
}
